<template>
	<view class="container">
		<c-navBar title="驳回原因" isPerch></c-navBar>
		<view class="content">
			<view class="title">审核内容</view>
			<view class="text">
				{{ detail.endCause ? detail.endCause : detail.startCause }}
			</view>
		</view>


		<view class="btn-box">
			<view class="btn" @click="reupload">重新上传</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				file: [],
				detail: null,
				name: '',
				id: '',
			}
		},
		onLoad({
			name,
			id
		}) {
			this.name = name;
			this.id = id;
		},
		onShow() {
			this.getDetail();
		},
		methods: {
			getDetail() {
				if (this.name == 'worker') {
					this.$api.workerTaskDetail({
						id: this.id
					}).then(res => {
						if (res.code == 200) {
							this.detail = res.data;
						}
					})
				} else {
					this.$api.machineTaskDetail({
						id: this.id
					}).then(res => {
						if (res.code == 200) {
							this.detail = res.data;
						}
					})
				}
			},
			// 重新上传
			reupload() {

				if (this.name == 'worker') {
					if (this.detail.useStatus == 1) {
						uni.navigateTo({
							url: `/pages/home/taskCreate?name=worker&id=` + this.detail.id,
						})
					} else {
						uni.navigateTo({
							url: `/pages/home/startTask/reupload?name=worker&id=` + this.detail.id,
						})
					}
				} else {
					if (this.detail.useStatus == 1) {
						uni.navigateTo({
							url: `/pages/home/report?name=machine&id=` + this.detail.id,
						})
					} else {
						uni.navigateTo({
							url: `/pages/home/startTask/reupload?name=machine&id=` + this.detail.id,
						})
					}
				}


			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		.content {
			padding: 20rpx 32rpx;

			.title {
				font-weight: bold;
				font-size: 36rpx;
				color: #1A1A1A;
				margin-bottom: 24rpx;
			}

			.text {
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
			}
		}
	}
</style>